import json
from sqlalchemy.ext.asyncio import AsyncSession
from module_admin.dao.demo_dao import DemoDao
from module_admin.entity.vo.common_vo import CrudResponseModel
from module_admin.entity.vo.demo_vo import DemoModel


class DemoService:
    """
    测试服务
    """

    @classmethod
    async def add_demo_services(cls, query_db: AsyncSession, demo: DemoModel):
        """
        测试服务
        :param query_db:
        :param page_object:
        :return:
        """

        add_demo = await DemoDao.add_demo_dao(query_db, demo)
        await query_db.commit()

        return CrudResponseModel(is_success=True, message='操作成功', result=add_demo)
